#ifndef PROGRAMMANAGEMENT_HPP
#define PROGRAMMANAGEMENT_HPP

#include <QObject>
#include <QMap>

#include "command.hpp"

/**
* @brief
*
* @class ProgramManagement programmanagement.hpp "programmanagement.hpp"
*/
class ProgramManagement : public QObject
{
Q_OBJECT
public:
    /**
    * @brief Constructor for ProgramManagement
    *
    * @fn explicit ProgramManagement(QObject *parent = 0)
    * @param parent
    */
    explicit ProgramManagement(QObject *parent = 0);

    /**
    * @brief Copy Constructor for ProgramMangement
    *
    * @fn explicit ProgramManagement(ProgramManagement &other)
    * @param other
    */
    explicit ProgramManagement(ProgramManagement &other);

    /**
    * @brief Destructs the instance
    *
    * @fn ~ProgramManagement()
    */
    ~ProgramManagement();

    /**
    * @brief Adds a Command object to the ProgrammManagement
    *
    * @fn void addCommand(Command &command)
    * @param command
    */
    void addCommand(Command &command);


    /**
    * @brief Returns the commandlist as pointer
    *
    * @fn const QList<Command> *getCommandList() const
    * @return const QList<Command *>
    */
    const QList<Command> *getCommandList() const;

    /**
    * @brief Returns the commandmap as pointer
    *
    * @fn QMap<int, Command> *getCommandMap()
    * @return const QMap<int, Command *>
    */
    QMap<int, Command> *getCommandMap();

    /**
    * @brief Prepare for a new Program
    *
    * @fn reset
    */
    void reset();

    /**
    * @brief Returns if there is a breakpoint on the givin line
    *
    * @fn bool hasBreakpointOnLine(int line) const
    * @param line
    * @return bool
    */
    bool hasBreakpointOnLine(int line) const;

private:
    QMap<int, Command> commandMap;
    QList<Command> commandList;
    QList<int> breakpointList;

signals:
    void breakPointToggled(int line, bool add, QString asmCode, QString anchor);

public slots:
    /**
    * @brief Sets and unsets a breakpoint on the given line
    *
    * @fn void onRequestBreakpoint(int line)
    * @param line
    */
    void onRequestBreakpoint(int line);
};

#endif // PROGRAMMANAGEMENT_HPP
